<?php

class UserInfo extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     * @Primary
     * @Identity
     * @Column(type="integer", length=11, nullable=false)
     */
    public $id;

    /**
     *
     * @var string
     * @Column(type="string", length=50, nullable=false)
     */
    public $openid;

    /**
     *
     * @var string
     * @Column(type="string", length=100, nullable=false)
     */
    public $nickname;

    /**
     *
     * @var integer
     * @Column(type="integer", length=10, nullable=true)
     */
    public $sex;

    /**
     *
     * @var string
     * @Column(type="string", length=50, nullable=true)
     */
    public $city;

    /**
     *
     * @var string
     * @Column(type="string", length=50, nullable=true)
     */
    public $province;

    /**
     *
     * @var string
     * @Column(type="string", length=50, nullable=true)
     */
    public $country;

    /**
     *
     * @var string
     * @Column(type="string", length=150, nullable=true)
     */
    public $headimgurl;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $subscribe_time;

    /**
     *
     * @var string
     * @Column(type="string", length=150, nullable=true)
     */
    public $remark;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $groupid;

    /**
     *
     * @var string
     * @Column(type="string", length=255, nullable=true)
     */
    public $tagid_list;

    /**
     *
     * @var string
     * @Column(type="string", length=255, nullable=true)
     */
    public $subscribe_scene;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $qr_scene;

    /**
     *
     * @var string
     * @Column(type="string", length=255, nullable=true)
     */
    public $qr_scene_str;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $created_at;

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'user_info';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserInfo[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }
    public function beforeSave(){
        $this->tagid_list=implode(",",$this->tagid_list);
        $this->created_at=date("Y-m-d H:i:s");
    }
    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return UserInfo
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

}
